package com.health.db.dao.order.impl;

import java.util.ArrayList;

import java.util.List;

import com.health.db.dao.ServiceInterface;
import com.health.db.dao.order.IEPayCashPaymentDao;
import com.health.db.mapper.EPayCashPaymentMapper;
import com.health.db.model.EPayCashPayment;
import com.health.db.model.EPayCashPaymentExample;
import com.health.redis.RedisConstants;

/**
 * 支付日志 
 * @author YC
 *  未接入缓存系统
 */

public class EPayCashPaymentDaoImpl extends ServiceInterface implements IEPayCashPaymentDao{
	
	private EPayCashPaymentMapper ePayCashPaymentMapper;

	String selectByOrderId="registerId";
	public EPayCashPaymentMapper getePayCashPaymentMapper() {
		return ePayCashPaymentMapper;
	}

	public void setePayCashPaymentMapper(EPayCashPaymentMapper ePayCashPaymentMapper) {
		this.ePayCashPaymentMapper = ePayCashPaymentMapper;
	}
	
	@Override
	public int insert(EPayCashPayment record) {
		// TODO Auto-generated method stub
		return ePayCashPaymentMapper.insert(record);
	}

	
	@Override
	public List<EPayCashPayment> selectByOrderId(Long orderId) {

		List<EPayCashPayment> list=ePayCashPaymentMapper.selectByOrderId(orderId);
				
		return list;
		
	}
/*	@Override
	public List<EPayCashPayment> selectByOrderId(Long orderId) {
		
		getRedisOperatiorLogic();
		String key = RedisConstants.EPayCashPaymentMapper + selectByOrderId+ orderId;

		List<EPayCashPayment> list = new ArrayList<EPayCashPayment>();

		Object object = null;

		if (redisOperatiorLogic.isJedisIsConnected()) {

			// get data from redis
			object = redisOperatiorLogic.readObject(key,getPublicRedisGroupNo("1"));
		}

		if (null != object && !object.equals("")) {
			list = (List<EPayCashPayment>) object;
		} else {


			list=ePayCashPaymentMapper.selectByOrderId(orderId);
				if (redisOperatiorLogic.isJedisIsConnected()) {
					redisOperatiorLogic.setEx(key, list,getOrderRedisGroupNo("1"));
				}
		}

		return list;
		
	}*/

	@Override
	public int updateByPayCashIDSelective(EPayCashPayment record) {
		// TODO Auto-generated method stub
		return ePayCashPaymentMapper.updateByPayCashIDSelective(record);
	}

	@Override
	public List<EPayCashPayment> selectByExample(EPayCashPaymentExample example) {
		// TODO Auto-generated method stub
		return ePayCashPaymentMapper.selectByExample(example);
	}


}
